<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<link rel="shortcut icon" type="image/x-icon" href="../assets/favicon.ico">
<title>source\jindo.StarRating.js - Jindo Component - AjaxUI@NHN</title>
<link rel="stylesheet" type="text/css" href="../assets/prettify/prettify-min.css" media="screen">
<script type="text/javascript">
	var isMobile = (function() {
		var r = window.devicePixelRatio || 1;
		if (/windows phone/i.test(navigator.userAgent)) { r = 2; }
		
		var s = Math.max(screen.width / r, screen.height / r);
		
		var m = s < 1024;
		var href = m ? "api.mobile.css" : "api.css";
		document.write('<link rel="stylesheet" type="text/css" href="../assets/' + href + '" media="screen">');
		
		return m;
	})();
</script>

<script type="text/javascript" src="../assets/jindo.desktop.min.js"></script>
<script type="text/javascript" src="../assets/jindo_component.min.js"></script>
</head>
<body class="api-page">
<div id="wrap" class="api-main"><!-- 2Depth 접기 : lft_fold 추가 -->

	<div id="header">
		<h1><a href="../index.html"><span class="blind">JindoJS</span></a></h1>
		<div class="info">
			<span class="version">version 1.6.0</span>
			<span class="bar">|</span>
			<span class="help"><span class="ic_help"></span><a href="http://devcode.nhncorp.com/projects/jindo-component/issue" target="_blank">버그신고/문의</a></span>
		</div>
		<div class="menu">
			<button type="button" id="toggle_search_btn" class="btn_sch"><span class="blind">검색</span></button>
			<button type="button" id="toggle_list_btn" class="btn_snb btn_snb_on"><span class="blind">메뉴</span></button>
			<!-- [D] 클릭시 btn_sch_on,btn_snb_on 추가 -->
		</div>
	</div>

	<!-- sch_frm -->
	<div class="sch_frm hide_when_small">
		<h2 class="blind">검색</h2>
		<div class="filter">
			<input type="search" id="api-filter" placeholder="검색어를 입력하세요.">
		</div>
		<div id="search-tab" style="display:none;">
			<ul class="tabs">
			<li class="tc-tab">전체</li>
			<li class="tc-tab">키워드</li>
			<li class="tc-tab">클래스</li>
			<li class="tc-tab">메서드</li>
			<li class="tc-tab">프로퍼티</li>
			<li class="tc-tab">이벤트</li>
			</ul>
			<div class="panels">
				<ul id="api-all" class="tc-panel"></ul>
				<ul id="api-keywords" class="tc-panel"></ul>
				<ul id="api-classes" class="tc-panel"></ul>
				<ul id="api-methods" class="tc-panel"></ul>
				<ul id="api-attrs" class="tc-panel"></ul>
				<ul id="api-events" class="tc-panel"></ul>
			</div>

		</div>
	</div>
	<!-- // sch_frm -->

	<!-- container -->
	<div id="container">
		<!-- left-columns -->
		<div id="left-columns" class="sidemenu has_scrollbar">
			<h2 class="blind"><a href="../index.html"><span>APIs</span></a></h2>
<div class="snb depth1 scrollbar hide_when_small">
	<!-- [D] style="width:135px; height:384px; -->
	<div class="scrollbar-box">
		<div class="scrollbar-content">
			<div><ul>
			            <li class="">
			            	<a href="../classes/jindo.Accordion.html" class="">
			                	Accordion
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.AjaxHistory.html" class="">
			                	AjaxHistory
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.BrowseButton.html" class="">
			                	BrowseButton
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.Cache.html" class="">
			                	Cache
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.Calendar.html" class="">
			                	Calendar
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.Canvas.html" class="">
			                	Canvas
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.CheckBox.html" class="">
			                	CheckBox
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.CircularRolling.html" class="">
			                	CircularRolling
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.Clipboard.html" class="">
			                	Clipboard
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.Component.html" class="">
			                	Component
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.DataBridge.html" class="">
			                	DataBridge
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.DatePicker.html" class="">
			                	DatePicker
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.DefaultTextValue.html" class="">
			                	DefaultTextValue
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.Dialog.html" class="">
			                	Dialog
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.DragArea.html" class="">
			                	DragArea
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.DropArea.html" class="">
			                	DropArea
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.DynamicTree.html" class="">
			                	DynamicTree
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.Effect.html" class="">
			                	Effect
								
								

							    
						        
						            <span class="flag static" title="static"><span class="blind">static</span></span>
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.FileUploader.html" class="">
			                	FileUploader
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.FloatingLayer.html" class="">
			                	FloatingLayer
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.Foggy.html" class="">
			                	Foggy
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.Formatter.html" class="">
			                	Formatter
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.HTMLComponent.html" class="">
			                	HTMLComponent
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.InlineTextEdit.html" class="">
			                	InlineTextEdit
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.LayerEffect.html" class="">
			                	LayerEffect
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.LayerManager.html" class="">
			                	LayerManager
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.LayerPosition.html" class="">
			                	LayerPosition
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.LazyLoading.html" class="">
			                	LazyLoading
								
								

							    
						        
						            <span class="flag static" title="static"><span class="blind">static</span></span>
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.ModalDialog.html" class="">
			                	ModalDialog
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.MouseGesture.html" class="">
			                	MouseGesture
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.MultipleAjaxRequest.html" class="">
			                	MultipleAjaxRequest
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.NumberFormatter.html" class="">
			                	NumberFormatter
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.NumericStepper.html" class="">
			                	NumericStepper
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.Pagination.html" class="">
			                	Pagination
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.Rolling.html" class="">
			                	Rolling
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.RollingChart.html" class="">
			                	RollingChart
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.RolloverArea.html" class="">
			                	RolloverArea
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.RolloverClick.html" class="">
			                	RolloverClick
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.ScrollBar.html" class="">
			                	ScrollBar
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.ScrollBox.html" class="">
			                	ScrollBox
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.SelectArea.html" class="">
			                	SelectArea
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.SelectBox.html" class="">
			                	SelectBox
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.Slider.html" class="">
			                	Slider
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.StarRating.html" class="">
			                	StarRating
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.TabControl.html" class="">
			                	TabControl
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.TextRange.html" class="">
			                	TextRange
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.Timer.html" class="">
			                	Timer
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.Transition.html" class="">
			                	Transition
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.Tree.html" class="">
			                	Tree
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.UIComponent.html" class="">
			                	UIComponent
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.UploadQueue.html" class="">
			                	UploadQueue
								
								

							    
						        
			            	</a>
			            </li>
			        
			            <li class="">
			            	<a href="../classes/jindo.WatchInput.html" class="">
			                	WatchInput
								
								

							    
						        
			            	</a>
			            </li>
			        </ul></div>
		</div>
	</div>
	<div class="scrollbar-v">
		<div class="scrollbar-button-up"></div>
		<div class="scrollbar-track">
			<div class="scrollbar-thumb" style="top: 0px; height: 222px; "></div>
		</div>
		<div class="scrollbar-button-down"></div>
	</div>
</div>


<button type="button" title="펼치기" class="btn_open">바로가기 열기<span class="ic"></span></button>
<button type="button" title="접기" class="btn_close">바로가기 닫기<span class="ic"></span></button>

		</div>
		<!-- // left-columns -->

		<!-- main content -->
		<div id="main">
			<div class="main_fix">
				<div class="content">
	
	<h1 class="blind">source/jindo.StarRating.js</h1>
	<div class="tc-panel first">
		<dl class="relation">
			<dt>파일명</dt>
			<dd>jindo.StarRating.js</dd>
			<dt>경로</dt>
			<dd>source/</dd>
		</dl>
		<div id="file" class="file">
		    <pre class="code prettyprint linenums">/**
	@fileOverview&nbsp;별점&nbsp;입력&nbsp;컴포넌트
	@author&nbsp;senxation
	@version&nbsp;#__VERSION__#
**/
/**
	jindo.StarRating&nbsp;컴포넌트는&nbsp;마우스&nbsp;이동,&nbsp;클릭으로&nbsp;별점을&nbsp;입력받습니다.
	
	@class&nbsp;jindo.StarRating
	@extends&nbsp;jindo.UIComponent
	@keyword&nbsp;starrating,&nbsp;rating,&nbsp;별점수,&nbsp;스타레이팅
**/
jindo.StarRating&nbsp;=&nbsp;jindo.$Class({
	/**&nbsp;@lends&nbsp;jindo.StarRating.prototype&nbsp;*/
		
	/**
		컴포넌트를&nbsp;생성한다.
		
		@constructor
		@param&nbsp;{HTMLElement}&nbsp;el&nbsp;베이스(기준)&nbsp;엘리먼트
		@param&nbsp;{Object}&nbsp;[htOption]&nbsp;옵션&nbsp;객체
			@param&nbsp;{Number}&nbsp;[htOption.nStep=1]&nbsp;설정가능한&nbsp;값의&nbsp;단계&nbsp;ex)&nbsp;1,&nbsp;0.5,&nbsp;0.25
			@param&nbsp;{Number}&nbsp;[htOption.nMaxValue=10]&nbsp;최대값
			@param&nbsp;{Number}&nbsp;[htOption.nDefaultValue=0]&nbsp;로드시&nbsp;기본으로&nbsp;설정할&nbsp;값
			@param&nbsp;{Boolean}&nbsp;[htOption.bSnap=false]&nbsp;MouseMove시&nbsp;step별로&nbsp;스냅시킬지&nbsp;여부
			@param&nbsp;{Boolean}&nbsp;[htOption.bActivateOnload=true]&nbsp;로드시&nbsp;activate()&nbsp;수행여부
		@example
			oStarRating&nbsp;=&nbsp;new&nbsp;jindo.StarRating(jindo.$(&quot;star_rating&quot;),&nbsp;{
				nStep&nbsp;:&nbsp;1,&nbsp;//설정가능한&nbsp;값의&nbsp;단계&nbsp;ex)&nbsp;1,&nbsp;0.5,&nbsp;0.25
				nMaxValue&nbsp;:&nbsp;10,&nbsp;//최대값
				nDefaultValue&nbsp;:&nbsp;0,&nbsp;//로드시&nbsp;기본으로&nbsp;설정할&nbsp;값
				bSnap&nbsp;:&nbsp;false,&nbsp;//MouseMove시&nbsp;step별로&nbsp;스냅시킬지&nbsp;여부
				bActivateOnload&nbsp;:&nbsp;true&nbsp;//로드시&nbsp;컴포넌트&nbsp;활성화여부
			}).attach({
				move&nbsp;:&nbsp;function(oCustomEvent)&nbsp;{
					//마우스가&nbsp;별점&nbsp;위에서&nbsp;이동될&nbsp;때&nbsp;발생
					//이벤트&nbsp;객체&nbsp;oCustomEvent&nbsp;=&nbsp;{
					//	nValue&nbsp;:&nbsp;(Number)&nbsp;마우스이동에&nbsp;따른&nbsp;값&nbsp;(변환되기&nbsp;전&nbsp;값)
					//	nValueToBeSet&nbsp;:&nbsp;(Number)&nbsp;실제&nbsp;적용될&nbsp;값&nbsp;(nStep&nbsp;옵션에&nbsp;따라&nbsp;변환된&nbsp;값)
					//}
				},
				out&nbsp;:&nbsp;function(oCustomEvent)&nbsp;{
					//마우스가&nbsp;별점&nbsp;위에서&nbsp;벗어났을&nbsp;때&nbsp;발생
				},
				set&nbsp;:&nbsp;function(oCustomEvent)&nbsp;{
					//&nbsp;값이&nbsp;설정되었을&nbsp;때&nbsp;발생
					//이벤트&nbsp;객체&nbsp;oCustomEvent&nbsp;=&nbsp;{
					//	nValue&nbsp;:&nbsp;(Number)&nbsp;설정된&nbsp;값
					//}
				}
			});
	**/
	$init&nbsp;:&nbsp;function(el,&nbsp;htOption)&nbsp;{
		//옵션&nbsp;초기화
		var&nbsp;htDefaultOption&nbsp;=&nbsp;{
			nStep&nbsp;:&nbsp;1,&nbsp;//설정가능한&nbsp;값의&nbsp;단계&nbsp;ex)&nbsp;1,&nbsp;0.5,&nbsp;0.25
			nMaxValue&nbsp;:&nbsp;10,&nbsp;//최대값
			nDefaultValue&nbsp;:&nbsp;0,&nbsp;//로드시&nbsp;기본으로&nbsp;설정할&nbsp;값
			bSnap&nbsp;:&nbsp;false,&nbsp;//MouseMove시&nbsp;step별로&nbsp;스냅시킬지&nbsp;여부
			bActivateOnload&nbsp;:&nbsp;true&nbsp;//로드시&nbsp;컴포넌트&nbsp;활성화여부
		};
		this.option(htDefaultOption);
		this.option(htOption&nbsp;||&nbsp;{});
		//Base&nbsp;엘리먼트&nbsp;설정
		this._el&nbsp;=&nbsp;jindo.$(el);
		this._wel&nbsp;=&nbsp;jindo.$Element(el);

		//컴포넌트에서&nbsp;사용되는&nbsp;HTMLElement들을&nbsp;선언하는&nbsp;메서드
		this._assignHTMLElements();
		
		this._wfMouseMove&nbsp;=&nbsp;jindo.$Fn(this._onMouseMove,&nbsp;this);
		this._wfMouseLeave&nbsp;=&nbsp;jindo.$Fn(this._onMouseLeave,&nbsp;this);
		this._wfClick&nbsp;=&nbsp;jindo.$Fn(this._onClick,&nbsp;this);
		
		//활성화
		if(this.option(&quot;bActivateOnload&quot;))&nbsp;{
			this.activate();&nbsp;//컴포넌트를&nbsp;활성화한다.	
		}
	},

	/**
		컴포넌트에서&nbsp;사용되는&nbsp;HTMLElement들을&nbsp;선언하는&nbsp;메서드
	**/
	_assignHTMLElements&nbsp;:&nbsp;function()&nbsp;{
		this._elRatingElement&nbsp;=&nbsp;jindo.$$.getSingle(&quot;span&quot;,&nbsp;this.getBaseElement());
		this._welRatingElement&nbsp;=&nbsp;jindo.$Element(this._elRatingElement);
	},
	
	/**
		컴포넌트의&nbsp;베이스&nbsp;엘리먼트를&nbsp;가져온다.
		
		@method&nbsp;getBaseElement
		@return&nbsp;{HTMLElement}
	**/
	getBaseElement&nbsp;:&nbsp;function()&nbsp;{
		return&nbsp;this._el;
	},

	/**
		별점의&nbsp;점수를&nbsp;표시할&nbsp;엘리먼트를&nbsp;구한다.
		
		@method&nbsp;getRatingElement
		@return&nbsp;{HTMLElement}
	**/
	getRatingElement&nbsp;:&nbsp;function()&nbsp;{
		return&nbsp;this._elRatingElement;
	},
	
	/**
		설정된&nbsp;값을&nbsp;구한다.
		
		@method&nbsp;getValue
		@return&nbsp;{Number}&nbsp;0과&nbsp;option의&nbsp;maxValue&nbsp;사이의&nbsp;값
	**/
	getValue&nbsp;:&nbsp;function()&nbsp;{
		return&nbsp;this._nValue;	
	},
	
	/**
		활성화된&nbsp;RatingElement의&nbsp;가로&nbsp;길이로부터&nbsp;설정된&nbsp;값을&nbsp;구한다.
		
		@method&nbsp;getValueByWidth
		@return&nbsp;{Number}&nbsp;0과&nbsp;option의&nbsp;maxValue&nbsp;사이의&nbsp;값
	**/
	getValueByWidth&nbsp;:&nbsp;function()&nbsp;{
		return&nbsp;this._welRatingElement.width()&nbsp;/&nbsp;this._nBaseWidth&nbsp;*&nbsp;this.option(&quot;nMaxValue&quot;);	
	},
	
	/**
		실제로&nbsp;설정될&nbsp;값을&nbsp;가져온다.
		
		@method&nbsp;getValueToBeSet
		@param&nbsp;{Number}&nbsp;nValue&nbsp;설정하고자&nbsp;하는&nbsp;값
		@return&nbsp;{Number}&nbsp;nStep&nbsp;옵션에&nbsp;따라&nbsp;변환된&nbsp;값.
		@example
			//nStep옵션이&nbsp;1인&nbsp;경우
			oStarRating.getValueToBeSet(3.15);&nbsp;//&nbsp;3
	**/
	getValueToBeSet&nbsp;:&nbsp;function(nValue)&nbsp;{
		nValue&nbsp;=&nbsp;this._round(nValue,&nbsp;this.option(&quot;nStep&quot;));
		nValue&nbsp;=&nbsp;Math.min(nValue,&nbsp;this.option(&quot;nMaxValue&quot;));
		nValue&nbsp;=&nbsp;Math.max(nValue,&nbsp;0);
		return&nbsp;nValue;
	},
	
	/**
		&nbsp;값을&nbsp;설정한다.
		
		@method&nbsp;setValue
		@param&nbsp;{Number}&nbsp;nValue&nbsp;0과&nbsp;option의&nbsp;maxValue&nbsp;사이의&nbsp;값
		@param&nbsp;{Boolean}&nbsp;bFireEvent&nbsp;&quot;set&quot;&nbsp;커스텀&nbsp;이벤트를&nbsp;발생할지&nbsp;여부
		@return&nbsp;{this}
	**/
	setValue&nbsp;:&nbsp;function(nValue,&nbsp;bFireEvent)&nbsp;{
		if&nbsp;(typeof&nbsp;bFireEvent&nbsp;==&nbsp;&quot;undefined&quot;)&nbsp;{
			bFireEvent&nbsp;=&nbsp;true;	
		}

		var&nbsp;nMaxValue&nbsp;=&nbsp;this.option(&quot;nMaxValue&quot;);
		nValue&nbsp;=&nbsp;this.getValueToBeSet(nValue);
		
		var&nbsp;nWidth&nbsp;=&nbsp;this._nBaseWidth&nbsp;*&nbsp;nValue&nbsp;/&nbsp;nMaxValue;
		nWidth&nbsp;=&nbsp;Math.min(nWidth,&nbsp;this._nBaseWidth);
		
		this._welRatingElement.width(nWidth);
		this._nValue&nbsp;=&nbsp;nValue;
		
		if&nbsp;(bFireEvent)&nbsp;{
			/**
				&nbsp;값이&nbsp;설정되었을&nbsp;때
				
				@event&nbsp;set
				@param&nbsp;{String}&nbsp;sType&nbsp;커스텀&nbsp;이벤트명
				@param&nbsp;{Number}&nbsp;nValue&nbsp;설정된&nbsp;값
				@example
					//&nbsp;커스텀&nbsp;이벤트&nbsp;핸들링&nbsp;예제
					oStarRating.attach(&quot;set&quot;,&nbsp;function(oCustomEvent)&nbsp;{&nbsp;...&nbsp;});
			**/
			this.fireEvent(&quot;set&quot;,&nbsp;{&nbsp;nValue&nbsp;:&nbsp;this._nValue&nbsp;});
		}
		
		return&nbsp;this;
	},
	
	/**
		&nbsp;값을&nbsp;초기화한다.
		
		@method&nbsp;reset
		@return&nbsp;{this}
	**/
	reset&nbsp;:&nbsp;function()&nbsp;{
		var&nbsp;nValue&nbsp;=&nbsp;this.option(&quot;nDefaultValue&quot;)&nbsp;||&nbsp;0;
		this.setValue(nValue,&nbsp;false);
		return&nbsp;this;
	},
	
	/**
		소수점단위로도&nbsp;반올림
		@ignore
		@param&nbsp;{Number}&nbsp;nValue&nbsp;반올림할&nbsp;값
		@param&nbsp;{Number}&nbsp;nStep&nbsp;반올림&nbsp;단위&nbsp;(ex&nbsp;0.5)
	**/
	_round&nbsp;:&nbsp;function(nValue,&nbsp;nStep)&nbsp;{&nbsp;//9.9,&nbsp;&nbsp;0.5
		var&nbsp;nResult&nbsp;=&nbsp;nValue,
			nFloor&nbsp;=&nbsp;Math.floor(nValue),&nbsp;//9
			nMaxCandidate&nbsp;=&nbsp;nFloor&nbsp;+&nbsp;1,
			nCompare&nbsp;=&nbsp;1,
			nTempCompare,
			nCandidate,
			nFixed;
		
		for&nbsp;(nCandidate&nbsp;=&nbsp;nFloor;&nbsp;nCandidate&nbsp;&lt;=&nbsp;nMaxCandidate;&nbsp;nCandidate&nbsp;+=&nbsp;nStep)&nbsp;{
			nTempCompare&nbsp;=&nbsp;Math.abs(nValue&nbsp;-&nbsp;nCandidate);
			if&nbsp;(nTempCompare&nbsp;&lt;=&nbsp;nCompare)&nbsp;{
				nCompare&nbsp;=&nbsp;nTempCompare;
				nResult&nbsp;=&nbsp;nCandidate;
			}&nbsp;
		}
		
		return&nbsp;nResult.toFixed(Math.max((nStep.toString().length&nbsp;-&nbsp;2),&nbsp;0));
	},
	
	/**
		컴포넌트를&nbsp;활성화한다.
		@return&nbsp;{this}
	**/
	_onActivate&nbsp;:&nbsp;function()&nbsp;{
		var&nbsp;el&nbsp;=&nbsp;this.getBaseElement();
		this._wfMouseMove.attach(el,&nbsp;&quot;mousemove&quot;);
		this._wfMouseLeave.attach(el,&nbsp;&quot;mouseleave&quot;);
		this._wfClick.attach(el,&nbsp;&quot;click&quot;);
		
		this._nBaseWidth&nbsp;=&nbsp;this._wel.width();
		this.reset();
	},
	
	/**
		컴포넌트를&nbsp;비활성화한다.
		@return&nbsp;{this}
	**/
	_onDeactivate&nbsp;:&nbsp;function()&nbsp;{
		var&nbsp;el&nbsp;=&nbsp;this.getBaseElement();
		this._wfMouseMove.detach(el,&nbsp;&quot;mousemove&quot;);
		this._wfMouseLeave.detach(el,&nbsp;&quot;mouseleave&quot;);
		this._wfClick.detach(el,&nbsp;&quot;click&quot;);
	},
	
	_onMouseMove&nbsp;:&nbsp;function(we)&nbsp;{
		var&nbsp;nOffsetX&nbsp;=&nbsp;we.pos(true).offsetX&nbsp;+&nbsp;1,
			nWidth&nbsp;=&nbsp;(nOffsetX&nbsp;&gt;&nbsp;this._nBaseWidth)&nbsp;?&nbsp;this._nBaseWidth&nbsp;:&nbsp;nOffsetX,
			nValue;
		
		if&nbsp;(this.option(&quot;bSnap&quot;))&nbsp;{
			nValue&nbsp;=&nbsp;nOffsetX&nbsp;/&nbsp;this._nBaseWidth&nbsp;*&nbsp;this.option(&quot;nMaxValue&quot;);
			nWidth&nbsp;=&nbsp;this._round(nValue,&nbsp;this.option(&quot;nStep&quot;))&nbsp;*&nbsp;this._nBaseWidth&nbsp;/&nbsp;this.option(&quot;nMaxValue&quot;);
			nWidth&nbsp;=&nbsp;Math.min(nWidth,&nbsp;this._nBaseWidth);
		}
		this._welRatingElement.css(&quot;width&quot;,&nbsp;nWidth&nbsp;+&nbsp;&quot;px&quot;);
		
		nValue&nbsp;=&nbsp;this.getValueByWidth();
		/**
			마우스가&nbsp;별점&nbsp;위에서&nbsp;이동될&nbsp;때
			
			@event&nbsp;move
			@param&nbsp;{String}&nbsp;sType&nbsp;커스텀&nbsp;이벤트명
			@param&nbsp;{Number}&nbsp;nValue&nbsp;마우스이동에&nbsp;따른&nbsp;값&nbsp;(변환되기&nbsp;전&nbsp;값)
			@param&nbsp;{Number}&nbsp;nValueToBeSet&nbsp;적용될&nbsp;값&nbsp;(nStep&nbsp;옵션에&nbsp;따라&nbsp;변환된&nbsp;값)
			@example
				//&nbsp;커스텀&nbsp;이벤트&nbsp;핸들링&nbsp;예제
				oStarRating.attach(&quot;move&quot;,&nbsp;function(oCustomEvent)&nbsp;{&nbsp;...&nbsp;});
		**/
		this.fireEvent(&quot;move&quot;,&nbsp;{
			nValue&nbsp;:&nbsp;nValue,
			nValueToBeSet&nbsp;:&nbsp;this.getValueToBeSet(nValue)
		});
	},
	
	_onMouseLeave&nbsp;:&nbsp;function(we)&nbsp;{
		this.setValue(this._nValue,&nbsp;false);
		/**
			마우스가&nbsp;별점&nbsp;위에서&nbsp;벗어났을&nbsp;때
			
			@event&nbsp;out
			@param&nbsp;{String}&nbsp;sType&nbsp;커스텀&nbsp;이벤트명
			@example
				//&nbsp;커스텀&nbsp;이벤트&nbsp;핸들링&nbsp;예제
				oStarRating.attach(&quot;out&quot;,&nbsp;function(oCustomEvent)&nbsp;{&nbsp;...&nbsp;});
		**/
		this.fireEvent(&quot;out&quot;);
	},
	
	_onClick&nbsp;:&nbsp;function(we)&nbsp;{
		this.setValue(this.getValueByWidth());
	}
}).extend(jindo.UIComponent);	</pre>
		</div>
	</div>
</div>

			</div>
		</div>
		<!-- // main content -->

	</div>
	<!-- // container -->

	<!-- footer -->
	<div id="footer">
		<p>Copyright ©<a href="http://nhncorp.com/" target="_blank">NHN Corp.</a> Platform Ajax Team. All Rights Reserved.</p>
	</div>
	<!-- // footer -->

</div>
<!-- // wrap -->

<style type="text/css">

	.item {
		transition:background .2s linear;
		-webkit-transition:background .2s linear;
		-moz-transition:background .2s linear;
		-o-transition:background .2s linear;
		-ms-transition:background .2s linear;
	}
	
	.highlight {
		background-color:#ffffd8 !important;
	}
	
	li.selected a.highlight {
		background-color:#aa8 !important;
	}
	
	.hide-deprecated .deprecated-item, .hide-inherited .inherited-item, .private {
		display:none;
	}
	
	.scrollbar-v, .scrollbar-h { display:none; }
	.scrollbar-show { display:block; }
	
	.api-page .tbl_fold .more_history { display:none; }
	
	/* FILE */
	.file pre.code {
		border:1px solid #ccc;
		padding:0;
	}
	
	.file ol {
		padding-left: 4em;
		background-color: #f9f9f9;
	}

	.file ol li {
		list-style: decimal;
		border-left:1px solid #ccc;
		padding:2px 4px;
	}
	
	.file li.L1, .file li.L3, .file li.L5, .file li.L7, .file li.L9 {
		background-color: #f9f9f9;	
	}

	.file li.L0, .file li.L2, .file li.L4, .file li.L6, .file li.L8 { 
		background-color: #f0f0f0;
	}
	
</style>
<script type="text/javascript" src="../assets/prettify/prettify-min.js"></script>
<script type="text/javascript" src="../assets/hash.js"></script>
<script type="text/javascript" src="../assets/api-list.js"></script>
<script type="text/javascript" src="../assets/api-search.js"></script>
<script type="text/javascript" src="../assets/../api.js?callback=APISearch.setData"></script>
<script type="text/javascript">
	var projectRoot = "../";
	var projectAssets = "../assets";
	
    apiDocs(projectAssets);	
</script>
</body>
</html>